Chapter 10
Code example 10-1
Private Sub SeeMore_Click()
'This procedure displays a message then performs some arithmetic
'and displays the result.

Dim I As Integer, intTotal As Integer
Dim strText As String

MsgBox ("Tell me more")
    intTotal = 0
    For I = 20 To 1 Step -1
        intTotal = intTotal + 2
    Next
MsgBox intTotal
End Sub
Code example 10-2
Private Sub GetName()
'This procedure requests a name, then opens a form with records
'filtered to that name.

Dim strDocName As String
Dim strFilter As String, strName As String

strName = InputBox("Enter Sr Vol last name", "Last Name")
strFilter = "LastName = " & "'" & strName & "'"
strDocName = "DARs"
MsgBox strFilter
DoCmd.OpenForm strDocName, , , strFilter
End Sub

Access Power Programming with VBA, 8/23/2003, Web code examples
Virginia Andersen


